package puj.news.util;

import java.util.ArrayList;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;

import org.apache.commons.lang3.StringEscapeUtils;

import puj.news.dto.Noticia;

public class General {
	
		
	public static String clearCharactersHTML(String arg){
		
		
		/*for(int i=0;i<arg.length();i++){
			System.out.print(arg.charAt(i)+"="+arg.getBytes()[i]+",");
		}
		System.out.println();*/
		
		return StringEscapeUtils.escapeHtml4(arg).replaceAll("\\"+(char)63, "?").replaceAll("'", "&quot;");
	}
	
	public static String clearCharactersASCII(String arg){
		return StringEscapeUtils.escapeXml(arg);
	}
	
	public static List clearDetails(List <Noticia> l){
		List<Noticia> ls=new ArrayList();
		
		for (Iterator iter = l.iterator(); iter.hasNext();) {
			Noticia noticia = (Noticia) iter.next();
			noticia.setDetalle("");
			noticia.setResumen("");
			ls.add(noticia);
		}
		return ls;
	}

}
